<div class="fm-content">
    <div class="title">
        <i nz-icon [type]="'desktop'"></i> &nbsp;&nbsp;配图方案
    </div>
    <div class="work">
        <div class="top">
            <input nz-input placeholder="方案名称" class="fm-input first-input" [(ngModel)]="fs.queryObject['name:like']" />
            <nz-button-group class="fm-search-input">
                <button nz-button nzType="primary" (click)="fs.loadData(true)">查询</button>
                <button nz-button (click)="fs.resetQueryObject() && fs.loadData(true)">重置</button>
            </nz-button-group>
            <div class="tool-right">
                <nz-button-group>
                    <button nz-button [nzType]="'primary'" (click)="fs.addRow()">新增</button>
                    <button nz-button (click)="fs.editRow()">编辑</button>
                    <button nz-popconfirm nzTitle="确认删除选择项?" (nzOnConfirm)="fs.delEntitys()" nzPlacement="bottomRight"
                        nz-button>删除</button>
                </nz-button-group>
            </div>
        </div>

        <div class="work-content">
            <div class="table">
                <nz-table nzSize="middle" nzShowSizeChanger [nzPageSizeOptions]='[ 10, 15, 20, 30, 40, 50 ]'
                    [nzFrontPagination]="false" [nzData]="fs.datas" [nzLoading]="fs.isLoading || fs.isDeleing"
                    [nzTotal]="fs.rowsCount" [(nzPageIndex)]="fs.pageIndex" [(nzPageSize)]="fs.pageSize"
                    (nzPageIndexChange)="fs.loadData()" (nzPageSizeChange)="fs.loadData(true)">
                    <thead (nzSortChange)="fs.sort($event)" nzSingleSort>
                        <tr>
                            <th nzWidth="80px" nzShowCheckbox [(nzChecked)]="fs.allChecked"
                                [nzIndeterminate]="fs.indeterminate" (nzCheckedChange)="fs.checkAll($event)"></th>
                            <th>名称(编号)</th>
                            <th>有效</th>
                            <th>发布</th>
                            <th>备注</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr *ngFor="let data of fs.datas">
                            <td nzShowCheckbox [(nzChecked)]="data.checked" (nzCheckedChange)="fs.refreshCheckStatus()">
                            </td>
                            <td (click)="fs.editRow(data)" class="form-edit">{{data.name}}({{data.id}})</td>
                            <td>{{data.valid | boolReform}}</td>
                            <td>{{data.recommend | boolReform}}</td>
                            <td>{{data.info}}</td>
                        </tr>
                    </tbody>
                </nz-table>
            </div>
        </div>

        <nz-modal nzWidth='830' nzTitle="编辑" [nzMaskClosable]='false' [nzFooter]="null" [(nzVisible)]="fs.isEditVisible"
            (nzOnCancel)="fs.closeEdit()">
            <form nz-form [nzLayout]="'inline'">
                <div nz-row [nzGutter]="24">
                    <div nz-col [nzSpan]="12">
                        <nz-form-item>
                            <nz-form-label nzRequired class="form-label">编号</nz-form-label>
                            <nz-form-control class="form-control" [nzValidateStatus]="id.invalid?'error':'success'"
                                nzHasFeedback>
                                <input nz-input required [(ngModel)]="fs.er.id" name="id" #id="ngModel"
                                    [disabled]="!fs.er.FIELD_ISNEW">
                            </nz-form-control>
                        </nz-form-item>
                    </div>
                    <div nz-col [nzSpan]="12">
                        <nz-form-item>
                            <nz-form-label nzRequired class="form-label">名称</nz-form-label>
                            <nz-form-control class="form-control" [nzValidateStatus]="name.invalid?'error':'success'"
                                nzHasFeedback>
                                <input nz-input required [(ngModel)]="fs.er.name" id="name" name="name" #name="ngModel">
                            </nz-form-control>
                        </nz-form-item>
                    </div>
                </div>

                <div nz-row [nzGutter]="24">
                    <div nz-col [nzSpan]="12">
                        <nz-form-item>
                            <nz-form-label class="form-label">备注</nz-form-label>
                            <nz-form-control class="form-control">
                                <input nz-input [(ngModel)]="fs.er.info" id="info" name="info" #info="ngModel">
                            </nz-form-control>
                        </nz-form-item>
                    </div>
                    <div nz-col [nzSpan]="12">
                        <nz-form-item>
                            <nz-form-label nzRequired class="form-label">属性</nz-form-label>
                            <nz-form-control class="form-control">
                                <label nz-checkbox [(ngModel)]="fs.er.valid" name="valid">有效</label>
                                <label nz-checkbox [(ngModel)]="fs.er.recommend" name="leaf">发布</label>
                            </nz-form-control>
                        </nz-form-item>
                    </div>
                </div>
                <div nz-row [nzGutter]="24">
                    <div nz-col [nzSpan]="24">
                      <nz-form-item>
                        <nz-form-label nzRequired class="form-label">图标</nz-form-label>
                        <nz-form-control class="form-control3">
                          <nz-upload nzAction="{{ ffs.getUploadUrl() }}" [nzMultiple]="false" [nzShowUploadList]="true"
                            [nzShowButton]="fs.er.image ? fs.er.image.length < 1 : true" [(nzFileList)]="fs.er.image"
                            name="image" [nzAccept]="'.png,.jpg,.jpeg,.svg'" (nzChange)="ffs.handleChange($event)">
                            <button nz-button><i nz-icon type="upload"></i><span>上传</span></button>
                          </nz-upload>
                        </nz-form-control>
                      </nz-form-item>
                    </div>
                  </div>
                <div nz-row [nzGutter]="24">
                    <div nz-col [nzSpan]="12">
                        <nz-form-item>
                            <nz-form-label nzRequired class="form-label">排序</nz-form-label>
                            <nz-form-control class="form-control" [nzValidateStatus]="order.invalid?'error':'success'"
                                nzHasFeedback>
                                <nz-input-number class="form-control" required [(ngModel)]="fs.er.order" name="order"
                                    [nzMin]="1" #order="ngModel" [nzMax]="100" [nzStep]="1" class="form-control">
                                </nz-input-number>
                            </nz-form-control>
                        </nz-form-item>
                    </div>
                </div>

                <div nz-row [nzGutter]="24">
                    <div nz-col [nzSpan]="24" class="form-button-align">
                        <button nz-button nzType="default" (click)="fs.closeEdit()" class="form-button">取消</button>
                        <button nz-button nzType="primary" [disabled]='id.invalid || name.invalid || order.invalid'
                            (click)="fs.save()" [nzLoading]="fs.isSaveing">保存</button>
                    </div>
                </div>

            </form>
        </nz-modal>

    </div>
</div>